<template>
  <div class="__cart-goods-item">
    <p class="name">{{data.Name}}</p>
    <p class="price"><b>¥</b>{{data.Price * data.Num}}</p>
    <div class="handle-num">
      <Stepper v-model="data.Num" :min="0" @plus="onPlus" @minus="onMinus" />
    </div>
  </div>
</template>
<script>
import { Stepper } from 'vant';
export default {
  props: {
    data: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  components: {
    Stepper
  },
  methods: {
    onPlus() {
      this.$emit('change', {
        value: this.data.Num + 1,
        changeValue: 1,
        id: this.data.Id
      });
    },
    onMinus() {
      this.$emit('change', {
        value: this.data.Num - 1,
        changeValue: -1,
        id: this.data.Id
      });
    },
  },
  created() {
  }
}
</script>
<style lang="less" scoped>
.__cart-goods-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 50PX;
  font-size: 30px;
  .name{
    width: 380px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .price{
    text-align: right;
    width: 100px;
    font-size: 32px;
    color: #e51c24;
    b{
      font-weight: normal;
      font-size: 26px;
    }
  }
}
</style>